﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Uniforax.Core.Common;
using Uniforax.Core.GameActions;
using Uniforax.Core.Skills;

namespace Uniforax.Camp.TestData.SmallMiner
{
    public class SmallMinerMining : BaseSkill
    {
        public int MoneyAmount { get; set; } = 1;

        public override BaseSkillRange GetSkillRange()
        {
            return new SmallMinerMiningSkillRange();
        }

        public override void Effect(ActionContext context, SkillContext skillContext)
        {
            var world = context.GameWorld;
            var grid = world.GetGrid(skillContext.TargetPosId);
            var gameObject = grid.GetPlacedObject(skillContext.TargetObjectId);

            var playerId = gameObject.PlayerId;

            var addMoneyAction = new AddMoneyAction(playerId, MoneyAmount);
            context.History.Add(addMoneyAction);
            addMoneyAction.Execute(context);
        }
    }
}
